# Group Settings

**ADMIN**

To update or get any attribute of this data layer, you will need admin access. However a part of the schema is available to the general registered user without admin access.

**General**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `app-environment`  | App Environment (Eg. Production, testing) | string | **yes** |
| `app-name`  | Name of the application (Eg. Event Yay!, Open Event) | string | - |
| `tagline` | Tagline (Eg. Event Management and Ticketing, Home)  | string | - |
| `secret` | App Secret  | string | **yes** |
| `order-expiry-time`  | Expiry time for orders in minutes | Integer(default: 15) | - |
| `is-paypal-activated` | Whether paypal payment is configured or not | boolean | - |
| `is-stripe-activated` | Whether stripe payment is configured or not | boolean | - |
| `is-omise-activated` | Whether omise payment is configured or not | boolean | - |


**STORAGE**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `storage-place`  | Storage of App (storage place, local, s3) | string | **yes** |

(S3)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `aws-key`  | Amazon Web Services key | string | **yes** |
| `aws-secret`  | Amazon Web Services secret | string | **yes** |
| `aws-bucket-name` | Amazon Web Services bucket name  | string | **yes** |
| `aws-region` | Amazon Web Services region  | string | **yes** |

(Google Storage)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `gs-key`  | Google Storage key | string | **yes** |
| `gs-secret`  | Google Storage Services secret | string | **yes** |
| `gs-bucket-name` | Google Storage bucket name  | string | **yes** |

**Social Login**
(Google Auth)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `google-client-id`  | Google client id | string | **yes** |
| `google-client-secret`  | Google client secret | string | **yes** |

(FB)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `fb-client-id`  | Facebook client id | string | **yes** |
| `fb-client-secret`  | Facebook client secret | string | **yes** |

(Twitter)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `tw-consumer-key`  | Twitter client id | string | **yes** |
| `tw-consumer-secret`  | Twitter client secret | string | **yes** |

(Instagram)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `in-client-id`  | Instagram client id | string | **yes** |
| `in-client-secret`  | Instagram client secret | string | **yes** |

**Payment Gateway**
(Stripe Keys)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `stripe-client-id`  | Stripe client id | string | **yes** |
| `stripe-secret-key`  | Stripe secret key | string | **yes** |
| `stripe-publishable-key`  | Stripe publishable key | string | **yes** |

(PayPal Credentials)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `paypal-mode`  | Paypal mode | string | **yes** |
| `paypal-sandbox-client`  | Paypal sandbox client | string | **yes** |
| `paypal-sandbox-secret`  | Paypal sandbox secret | string | **yes** |
| `paypal-client`  | Paypal client | string | **yes** |
| `paypal-secret`  | Paypal secret | string | **yes** |

(Omise Credentials)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `omise-mode`  | Omise mode | string | **yes** |
| `omise-test-public`  | Omise Test Public Key | string | **yes** |
| `omise-test-secret`  | Omise Test Secret Key | string | **yes** |
| `omise-live-public`  | Omise Live Public Key | string | **yes** |
| `omise-live-secret`  | Omise Live Secret Key | string | **yes** |

**EMAIL**
(Email service)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `email-service`  | Email service | string | **yes** |
| `email-from`  | Email from | string | **yes** |
| `email-from-name`  | Email Sender name | string | **yes** |

(Sendgrid)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `sengrid-key`  | Sendgrid key | string | **yes** |

(SMTP)
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `smtp-host`  | smtp host | string | **yes** |
| `smtp-username`  | smtp  username | string | **yes** |
| `smtp-password`  | smtp  password | string | **yes** |
| `smtp-port`  | smtp  port | string | **yes** |
| `smtp-encryption`  | smtp  encryption | string | **yes** |

**Google Analytics**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `analytics-key`  | Google analytics key | string | - |

**Social links**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `google-url`  | Google url | string | **yes** |
| `github-url`  | Github url | string | **yes** |
| `twitter-url`  | Twitter url | string | **yes** |
| `support-url`  | Support url | string | **yes** |
| `facebook-url`  | Facebook url | string | **yes** |
| `youtube-url`  | Youtube url | string | **yes** |

**Generators**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `android-app-url`  | Android app url | string | **yes** |
| `web-app-url`  | Web App url | string | **yes** |

**Frontend Url**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `frontend-url`  | Url of Open Event Frontend | string (url with scheme) | - |

 **Cookie Policy**
| Parameter | Description | Type | Admin Only |
|:----------|-------------|------|------------|
| `cookie-policy`  | Warning to be displayed on the frontend | string | - |
| `cookie-policy-link`  | Link to the full cookie policy | string | - |

## Settings Details [/v1/settings{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `app-name`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.

### Show Settings[GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "data": {
            "attributes": {
              "app-environment": "testing",
              "app-name": "Event Yay!",
              "tagline": "Event Management and Ticketing",
              "order-expiry-time": "15",
              "storage-place": "s3",
              "aws-key": "example1234",
              "aws-secret": "example1234",
              "aws-bucket-name": "myawsbucet",
              "aws-region": "us-west",
              "gs-key": "example1234",
              "gs-secret": "example1234",
              "gs-bucket-name": "mygsbucket",
              "google-client-id":"example1234",
              "google-client-secret": "example1234",
              "fb-client-id": "example1234",
              "fb-client-secret": "example1234",
              "tw-consumer-key": "example1234",
              "tw-consumer-secret": "example1234",
              "in-client-id": "example1234",
              "in-client-secret": "example1234",
              "stripe-client-id": "example1234",
              "stripe-secret-key": "example1234",
              "stripe-publishable-key": "example1234",
              "paypal-mode": "development",
              "paypal-sandbox-secret": "example1234",
              "paypal-sandbox-client": "example1234",
              "paypal-secret": "example1234",
              "paypal-client": "example1234",
              "omise-mode": "development",
              "omise-test-public": "example1234",
              "omise-test-secret": "example1234",
              "omise-live-public": "example1234",
              "omise-live-secret": "example1234",
              "email-service": "example",
              "email-from": "example@example.com",
              "email-from-name": "example",
              "sendgrid-key": "example1234",
              "smtp-host": "smtp.gmail.com",
              "smtp-username":"example",
              "smtp-password": "example",
              "smtp-port": 25,
              "smtp-encryption": "example1234",
              "analytics-key": "example1234",
              "google-url": "http://example.com",
              "github-url": "http://example.com",
              "twitter-url": "http://example.com",
              "support-url": "http://example.com",
              "facebook-url": "http://example.com",
              "youtube-url": "http://example.com",
              "android-app-url": "http://example.com",
              "web-app-url": "http://example.com",
              "static-domain": "http://example.com",
              "frontend-url": "http://example.com",
              "cookie-policy": "example",
              "cookie-policy-link": "http://example.com",
              "is-paypal-activated": false,
              "is-stripe-activated": false
            },
            "type": "setting",
            "id": "1",
            "links": {
              "self": "/v1/settings?id=1"
            }
          },
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/settings?id=1"
          }
        }

### Update Settings [PATCH]

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "attributes": {
                  "app-environment": "testing",
                  "app-name": "Event Yay!",
                  "tagline": "Event Management and Ticketing",
                  "storage-place": "s3",
                  "aws-key": "example1234",
                  "aws-secret": "example1234",
                  "aws-bucket-name": "myawsbucet",
                  "aws-region": "us-west",
                  "gs-key": "example1234",
                  "gs-secret": "example1234",
                  "gs-bucket-name": "mygsbucket",
                  "google-client-id":"example1234",
                  "google-client-secret": "example1234",
                  "fb-client-id": "example1234",
                  "fb-client-secret": "example1234",
                  "tw-consumer-key": "example1234",
                  "tw-consumer-secret": "example1234",
                  "in-client-id": "example1234",
                  "in-client-secret": "example1234",
                  "stripe-client-id": "example1234",
                  "stripe-secret-key": "example1234",
                  "stripe-publishable-key": "example1234",
                  "paypal-mode": "development",
                  "paypal-sandbox-secret": "example1234",
                  "paypal-sandbox-client": "example1234",
                  "paypal-secret": "example1234",
                  "paypal-client": "example1234",
                  "omise-mode": "development",
                  "omise-test-public": "example1234",
                  "omise-test-secret": "example1234",
                  "omise-live-public": "example1234",
                  "omise-live-secret": "example1234",
                  "email-service": "example",
                  "email-from": "example@example.com",
                  "email-from-name": "example",
                  "sendgrid-key": "example1234",
                  "smtp-host": "smtp.gmail.com",
                  "smtp-username":"example",
                  "smtp-password": "example",
                  "smtp-port": 25,
                  "smtp-encryption": "example1234",
                  "analytics-key": "example1234",
                  "google-url": "http://example.com",
                  "github-url": "http://example.com",
                  "twitter-url": "http://example.com",
                  "support-url": "http://example.com",
                  "facebook-url": "http://example.com",
                  "youtube-url": "http://example.com",
                  "android-app-url": "http://example.com",
                  "web-app-url": "http://example.com",
                  "static-domain": "http://example.com",
                  "frontend-url": "http://example.com",
                  "cookie-policy": "example",
                  "cookie-policy-link": "http://example.com"
                },
                "type": "setting",
                "id": "1"
              }
            }


+ Response 200 (application/vnd.api+json)

        {
          "data": {
            "attributes": {
              "app-environment": "testing",
              "app-name": "Event Yay!",
              "tagline": "Event Management and Ticketing",
              "order-expiry-time": "15",
              "storage-place": "s3",
              "aws-key": "example1234",
              "aws-secret": "example1234",
              "aws-bucket-name": "myawsbucet",
              "aws-region": "us-west",
              "gs-key": "example1234",
              "gs-secret": "example1234",
              "gs-bucket-name": "mygsbucket",
              "google-client-id":"example1234",
              "google-client-secret": "example1234",
              "fb-client-id": "example1234",
              "fb-client-secret": "example1234",
              "tw-consumer-key": "example1234",
              "tw-consumer-secret": "example1234",
              "in-client-id": "example1234",
              "in-client-secret": "example1234",
              "stripe-client-id": "example1234",
              "stripe-secret-key": "example1234",
              "stripe-publishable-key": "example1234",
              "paypal-mode": "development",
              "paypal-sandbox-secret": "example1234",
              "paypal-sandbox-client": "example1234",
              "paypal-secret": "example1234",
              "paypal-client": "example1234",
              "omise-mode": "development",
              "omise-test-public": "example1234",
              "omise-test-secret": "example1234",
              "omise-live-public": "example1234",
              "omise-live-secret": "example1234",
              "email-service": "example",
              "email-from": "example@example.com",
              "email-from-name": "example",
              "sendgrid-key": "example1234",
              "smtp-host": "smtp.gmail.com",
              "smtp-username":"example",
              "smtp-password": "example",
              "smtp-port": 25,
              "smtp-encryption": "example1234",
              "analytics-key": "example1234",
              "google-url": "http://example.com",
              "github-url": "http://example.com",
              "twitter-url": "http://example.com",
              "support-url": "http://example.com",
              "facebook-url": "http://example.com",
              "youtube-url": "http://example.com",
              "android-app-url": "http://example.com",
              "web-app-url": "http://example.com",
              "static-domain": "http://example.com",
              "frontend-url": "http://example.com",
              "cookie-policy": "example",
              "cookie-policy-link": "http://example.com",
              "is-paypal-activated": false,
              "is-stripe-activated": false
            },
            "type": "setting",
            "id": "1",
            "links": {
              "self": "/v1/settings?id=1"
            }
          },
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/settings?id=1"
          }
        }
